package com.huawei.appgallery.foundation.ui.framework.activity;

import android.app.Activity;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import com.huawei.appgallery.foundation.ui.framework.titleframe.bean.BaseTitleBean;
import o.cjd;
import o.cje;
import o.cjf;
import o.cjo;
import o.djc;
import o.dky.h;
import o.Logger;
import o.ebn;

public abstract class BaseActivity<T extends cjo> extends AbstractBaseActivity<T> {
    private cjf ˊॱ;

    public void onResume() {
        super.onResume();
        ebn.ॱ().ॱ((Activity) this);
    }

    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        if (keyEvent.getKeyCode() == 82) {
            Logger.ˎ("BaseActivity", getClass().getSimpleName() + ", event.getKeyCode() == KeyEvent.KEYCODE_MENU");
            return true;
        }
        djc.ˊ(i, keyEvent, this);
        return super.onKeyDown(i, keyEvent);
    }

    protected void ॱ(String str) {
        View findViewById = findViewById(h.ॱˌ);
        if (findViewById instanceof ViewGroup) {
            ViewGroup viewGroup = (ViewGroup) findViewById;
            this.ˊॱ = ˊ(str);
            View ˋ = this.ˊॱ.ˋ();
            if (ˋ != null) {
                viewGroup.setVisibility(0);
                viewGroup.addView(ˋ);
            }
        }
    }

    protected cjf ˊ(String str) {
        BaseTitleBean baseTitleBean = new BaseTitleBean();
        baseTitleBean.ॱ(str);
        cje o_cje = new cje();
        o_cje.ˎ(baseTitleBean);
        o_cje.ˋ("back_title");
        return cjd.ˋ(this, o_cje);
    }

    public void setTitle(int i) {
        super.setTitle(i);
        ˊ(getString(i));
    }

    public void setTitle(CharSequence charSequence) {
        super.setTitle(charSequence);
        ˊ(charSequence);
    }

    private void ˊ(CharSequence charSequence) {
        if (this.ˊॱ != null && charSequence != null) {
            BaseTitleBean ˎ = this.ˊॱ.ˎ();
            if (ˎ != null) {
                ˎ.ॱ(charSequence.toString());
                this.ˊॱ.ॱ(ˎ);
            }
        }
    }
}
